//引入mongoose
const mongoose = require("mongoose");

// new Schema 用它定义模型字段有哪些
const schema = new mongoose.Schema({
  name: { type: String },
  parent: {type:mongoose.SchemaTypes.ObjectId,ref:'Category'},
});

// 导入的是一个mongoose的模型
module.exports = mongoose.model("Category", schema);
